package D240514.Practice01;

public class SortUtil {
    public static void sort(MyComparable[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            boolean s = false;
            for (int j = 0; j < arr.length - 1; j++) {
                MyComparable s1 = arr[j];
                MyComparable s2 = arr[j + 1];
                if (s1.compareTo(s2) > 0) {
                    MyComparable temp = arr[j + 1];
                    arr[j + 1] = arr[j];
                    arr[j] = temp;
                    s = true;
                }
            }
            if (!s) {
                break;
            }
        }
    }
}
